package com.origin.app;

import static com.origin.uilibrary.xrecycleview.xr.LoadingMoreFooter.STATE_COMPLETE;
import static com.origin.uilibrary.xrecycleview.xr.LoadingMoreFooter.STATE_LOADING;
import static com.origin.uilibrary.xrecycleview.xr.LoadingMoreFooter.STATE_NOMORE;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.origin.uilibrary.xrecycleview.xr.BaseLoadingMoreFooter;

public class MyBaseLoadingMoreFooter extends BaseLoadingMoreFooter {
    public MyBaseLoadingMoreFooter(Context context) {
        super(context);
    }

    public MyBaseLoadingMoreFooter(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public MyBaseLoadingMoreFooter(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public MyBaseLoadingMoreFooter(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    TextView mText;

    @Override
    public void initContainerView() {
        mText = new TextView(getContext());
        mText.setText("加载中...");
        addView(mText);
    }

    @Override
    public void destroy() {

    }

    @Override
    public void setState(int state) {
        switch(state) {
            case STATE_LOADING:
                this.setVisibility(View.VISIBLE);
                break;
            case STATE_COMPLETE:
                this.setVisibility(View.GONE);
                break;
            case STATE_NOMORE:
                this.setVisibility(View.VISIBLE);
                break;
        }
    }
}
